/*
 * EditorFactory.java
 * 
 * Created by demory on Nov 21, 2009, 9:48:25 PM
 * 
 * Copyright 2008 David D. Emory
 * 
 * This file is part of Five Points. See <http://www.fpdev.org> for
 * additional information regarding the project.
 * 
 * Five Points is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Five Points is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Five Points.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.fpdev.apps.cart;

import java.io.File;
import org.fpdev.apps.cart.network.CartNetwork;

/**
 *
 * @author demory
 */
public class EditorFactory {

  private Cartographer cart_;
  private int currentID_;

  public EditorFactory(Cartographer cart) {
    cart_ = cart;
    currentID_ = 1;
  }

  public Editor createBlankEditor() {
    return new Editor(currentID_++, new CartDocument(), new CartActionHistory(cart_));
  }

  public Editor createEditorFromFile(File file) {
    CartDocument doc = new CartDocument();
    doc.readXMLFile(file);
    Editor ed = new Editor(currentID_++, doc, new CartActionHistory(cart_));
    return ed;
  }
}
